# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=logc
pkgver=0.5.0
pkgrel=0
pkgdesc="Logging library for C"
url="https://gitlab.nic.cz/turris/logc"
arch="all"
license="MIT"
makedepends="
	argp-standalone
	gperf
	libconfig-dev
	meson
	"
subpackages="
	$pkgname-dev
	$pkgname-argp
	$pkgname-config:_config
	"
source="https://gitlab.nic.cz/turris/logc/-/archive/v$pkgver/logc-v$pkgver.tar.bz2"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check"  # tests are not supported on musl

build() {
	abuild-meson \
		-Dlibargp=enabled \
		-Dlibconfig=enabled \
		-Dtests=disabled \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

argp() {
	pkgdesc="$pkgdesc - argp integration"
	depends="$pkgname=$pkgver-r$pkgrel"

	amove usr/lib/liblogc_argp.so*
}

_config() {
	pkgdesc="$pkgdesc - libconfig integration"
	depends="$pkgname=$pkgver-r$pkgrel"

	amove usr/lib/liblogc_config.so*
}

sha512sums="
425dad537f891891a314b7b0b95f14987b0adffb5bbe9fd511cfe83ddc965b1eace9e71670463ed4a87444ba56bceeb8b61d07f07cf89b8674f6efb38a58faf2  logc-v0.5.0.tar.bz2
"
